<?php

/* 留言
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

require 'dbcon.php';
$e_name= $_REQUEST['e_name'];
$e_dept= $_REQUEST['e_dept'];
$e_img= $_REQUEST['e_img'];
$date_of_birth= $_REQUEST['date_of_birth'];
$date_of_entry=date('Y-m-d H:i:s');
$sql= "INSERT INTO `db_emp`.`tb_emp` (`id`, `e_name`, `e_dept`, `e_img`, `date_of_birth`, `date_of_entry`) VALUES (NULL, '{$e_name}', '{$e_dept}', '{$e_img}', '{$date_of_birth}', '{$date_of_entry}')";//插入数据
$rs=$db->query($sql);//$rs返回值  如果成功，返回true 如果失败，返回false
if ($rs==true)
{
    header("Location:index.php");
}
else{
    echo '<script type="text/javascrip">;';
    echo 'alert("留言失败");';
    echo 'window.locatin.href="index.php";';
    echo '</script>;';
}